package com.wanxi.springboot.dao;

import com.wanxi.springboot.entity.User;
import com.wanxi.springboot.entity.UserEntity;
import org.apache.ibatis.annotations.*;

import java.util.List;
@Mapper
public interface UserDao {

    @Insert("insert into springboot.user(id,name,age) values(#{id},#{name},#{age})")
    int add(UserEntity userEntity);
    @Options(useGeneratedKeys=true, keyProperty="id")
    @Select("select * from springboot.user")
    List<UserEntity> findall();
    @Select("select * from springboot.user where id=#{id}")
    UserEntity findById(int id);
    @Delete("delete from springboot.user where id=#{id}")
     int del(int id);
    @Update("update springboot.user set name=#{name},age=#{age} where id=#{id}")
    int edit(UserEntity userEntity);
    @Select("select * from springboot.user")
    List<User> list();
}

